package com.blank.shop.dubbo.service;

import com.blank.shop.dubbo.ShopAlibabaDubboConsumerApplication;
import com.blank.shop.dubbo.api.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <br/>Date 2021/9/1
 * <br/>Time 18:11:33
 *
 * @author _blank
 */
@FeignClient(name = ShopAlibabaDubboConsumerApplication.SERVER_PROVIDER_NAME)
public interface FeignRestService {

    @GetMapping("/param")
    String param(@RequestParam("param") String param);

    @PostMapping("/params")
    String params(@RequestParam("b") String b, @RequestParam("a") int a);

    @PostMapping(value = "/request/body/map", produces = MediaType.APPLICATION_JSON_VALUE)
    User requestBody(@RequestParam("param") String param, @RequestBody Map<String, Object> data);

    @GetMapping("/headers")
    String headers(@RequestHeader("h2") String header2, @RequestHeader("h") String header, @RequestParam("v") Integer value);

    @GetMapping("/path-variables/{p1}/{p2}")
    String pathVariables(@PathVariable("p2") String path2, @PathVariable("p1") String path1, @RequestParam("v") String param);

}
